<template>
  <a-layout-header class="header">
    <div class="logo">
      <router-link to="/welcome" >
        仿12306管理控台
      </router-link>
    </div>
    <div style="float: right; color: white;">
<!--      您好：{{member.mobile}} &nbsp;&nbsp;
      <router-link to="/login" style="color: white;">
        退出登录
      </router-link>-->
      欢迎使用管理控台
    </div>
    <a-menu
        v-model:selectedKeys="selectedKeys"
        theme="dark"
        mode="horizontal"
        :style="{ lineHeight: '64px' }"
    >
      <a-menu-item key="/welcome">
        <router-link to="/welcome">
          <coffee-outlined /> &nbsp; 欢迎
        </router-link>
      </a-menu-item>
<!--      <a-menu-item key="/passenger">
        <router-link to="/passenger">
          <user-outlined /> &nbsp; 乘车人管理
        </router-link>
      </a-menu-item>-->
      <a-menu-item key="/about">
        <router-link to="/about">
          <user-outlined /> &nbsp; 关于
        </router-link>
      </a-menu-item>
    </a-menu>
  </a-layout-header>
</template>

<script>
import {defineComponent, ref, watch} from 'vue';
//import store from "@/store";
import router from '@/router'


export default defineComponent({
  name: "the-header-view",
  setup() {
    //header只是显示，不会修改member值，声明为普通变量即可
    // let member = store.state.member;
    const selectedKeys = ref([]);
    //监视 路有变化，只放一个值 约定路由key和to一致
    watch(() => router.currentRoute.value.path, (newValue) => {
      console.log('watch', newValue);
      selectedKeys.value = [];
      selectedKeys.value.push(newValue);
    }, {immediate: true});
    return {
      //member,
      selectedKeys
    };
  },
});
</script>

<style scoped>
.logo {
  float: left;
  height: 31px;
  width: 150px;
  color: white;
  font-size: 20px;
  font-family: 华文行楷;
}
</style>
